import 'package:flutter_oldman_health/api/constant.dart';

class RemoteControlReceivedModel {
  String msgType;
  String msgId;

  RemoteControlReceivedModel({this.msgType, this.msgId});

  factory RemoteControlReceivedModel.fromJson(Map<String, dynamic> json) {
    return RemoteControlReceivedModel(
      msgType: json['msgType'],
      msgId: json['msgId'],
    );
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['msgType'] = this.msgType;
    data['msgId'] = this.msgId;
    return data;
  }
}

//{"msgType":"CreateRemoteControlConnectionAck","msgId":"8afb115b-1649-498f-ba35-69a87665c0a4",
// "sessionId":"e03e14e9fa884c188ec66f3ff0cdf3df1640316435386076","abilities":"dcapsrc_capturescreen"}
class RemoteConnectionAckModel {
  String msgType = "CreateRemoteControlConnectionAck";
  String msgId;
  String sessionId;
  String abilities;

  bool request() {
    print(abilities);
    if (abilities.contains(Constant.REMOTE_CONTROL_CONNECTION_ABILITIES)) {
      return true;
    }
    return false;
  }

  RemoteConnectionAckModel(
      {this.msgType, this.msgId, this.sessionId, this.abilities});

  factory RemoteConnectionAckModel.fromJson(Map<String, dynamic> json) {
    return RemoteConnectionAckModel(
      msgType: json['msgType'],
      msgId: json['msgId'],
      sessionId: json['sessionId'],
      abilities: json['abilities'],
    );
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['msgType'] = this.msgType;
    data['msgId'] = this.msgId;
    data['sessionId'] = this.sessionId;
    data['abilities'] = this.abilities;
    return data;
  }
}

class RemoteCaptureScreenModel {
  String msgType = "CreateRemoteControlConnectionAck";
  String msgId;
  int code;
  int time;
  int size;
  String imageBase64;

  RemoteCaptureScreenModel(
      {this.msgType,
      this.msgId,
      this.code,
      this.time,
      this.size,
      this.imageBase64});

  factory RemoteCaptureScreenModel.fromJson(Map<String, dynamic> json) {
    print("screenModel${json['code']} ${json['msgType']}");

    return RemoteCaptureScreenModel(
      msgType: json['msgType'],
      msgId: json['msgId'],
      code: json['code'],
      time: json['time'],
      size: json['size'],
      imageBase64: json['imageBase64'],
    );
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['msgType'] = this.msgType;
    data['msgId'] = this.msgId;
    data['code'] = this.code;
    data['time'] = this.time;
    data['size'] = this.size;
    data['imageBase64'] = this.imageBase64;
    return data;
  }

  bool success() {
    return code == 0;
  }
}

//{"msgType":"controller","userId":"b76926c5e1074ddbba3231c8b94612c7","channelId":"channel-6c01c91e-78e7-45e6-b0b4-fe158845718a"}
class RemoteControlRequestModel {
  String msgType;
  String userId;
  String channelId;

  RemoteControlRequestModel({this.msgType, this.userId, this.channelId});

  factory RemoteControlRequestModel.fromJson(Map<String, dynamic> json) {
    return RemoteControlRequestModel(
      msgType: json['msgType'],
      userId: json['userId'],
      channelId: json['channelId'],
    );
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['msgType'] = this.msgType;
    data['userId'] = this.userId;
    data['channelId'] = this.channelId;
    return data;
  }
}

//{"msgType":"controllerCancel"}

